def shopping_system():
    money = 50.0#钱
    products = [
        {"name": "苹果", "price": 2.0},
        {"name": "香蕉", "price": 2.5},
        {"name": "牛奶", "price": 4.0},
        {"name": "面包", "price": 8.5},
        {"name": "可乐", "price": 4.0}
    ]#商品
    cart = []#购物车
#购物
    print("可选购的商品：", [p["name"] for p in products])
    print(f"您的账户余额为：{money}元")
    print("输入商品名称购买，输入Q/q退出")
    while True:
        guke = input("请输入操作（商品名称/Q/q）: ")
        if guke.upper() == "Q":#退出
            break
        xuangou = None
        for p in products:#有商品
            if p["name"] == guke:
                xuangou = p
                break
        if not xuangou:#无商品
            print("没有这个商品，别瞎弄！")
            continue
        if money < xuangou["price"]:#钱不够
            print("穷鬼，钱不够！请到其他超市购买！")
            continue
        cart.append(xuangou)#添加到购物车
        print(f"恭喜，购买成功！已将{xuangou['name']}加入购物车")
        money -= xuangou["price"]#余额
        print(f"您的卡余额还剩：{money:.2f}元")
    print("\n=====购物小票=====")
    print("商品列表：")
    huaqian = 0.0
    for e in cart:  # 遍历购物车列表打印
        print(f"{e['name']}: {e['price']:.2f}元")
        huaqian += e["price"]
    print(f"总消费：{huaqian:.2f}元")
    print(f"账户余额：{money:.2f}元")
shopping_system()